feat: pymat.search(query) — fuzzy domain-library search#86
Merged
Conversation
3.3.0 minor bump — new public API; zero existing-behavior changes.
- pymat.search(query, *, limit=10) -> list[Material]
- Tokenized, conjunctive matching: every whitespace token must hit
somewhere (registry key / name / grade / hierarchy parent name).
- Weighted targets: key (10) > name/grade (5) > hierarchy path (3).
- Tie-break: shorter registry key ranks first — parents land above
longer-keyed descendants when both score the same.
- Triggers load_all() so results are exhaustive across categories.
- Complements pymat.vis.search() (visual catalog) with a symmetric
domain-side verb — two axes, same verb, no namespace collision.
30 tests in tests/test_search.py pinning tokenization, weights,
conjunctive matching, tie-breaks, limit= semantics, load_all side
effect, determinism, and realistic queries ("stainless 316",
"lyso ce saint", etc.).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a top-level fuzzy-find verb over the py-mat material registry. Symmetric with
pymat.vis.search(...)on the visual side.Closes #85.
Design
Material.name/grade(5), hierarchy parent names (3).load_all()for exhaustive results. Case-insensitive.list[Material]sorted best-first, truncated tolimit=.Test coverage
30 new tests in
tests/test_search.py:__all__membership[]limit=truncates after ranking, respects orderinglimit=0→[]_targets/_scoreunit tests pinning weights + logicSemver
Minor bump: 3.2.1 → 3.3.0. New public API, zero existing-behavior changes.
Test plan
pyproject.toml,src/pymat/__init__.py,.release-please-manifest.json, CHANGELOG.